package com.boot.dog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.boot.dog.entities.pojo.Permission;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author: MaxLv
 * @Date: 2019/12/2
 */
public interface PermissionMapper extends BaseMapper<Permission> {

    List<Permission> findByTypeAndStatusOrderBySortOrder(@Param("type") Integer type, @Param("status") Integer status);

    List<Permission> selectByRoleIdsAndDistinct(@Param("roleIds") List<Integer> roleIds, @Param("status") Integer status);

    Integer selectRoleCount(@Param("permissionId") Integer permissionId);

    List<Permission> selectByRoleIdsAndLevelAndDistinct(@Param("roleIds") List<Integer> roleIds, @Param("level") Integer level);

    List<Permission> selectByRoleIdsAndParentIdAndDistinct(@Param("roleIds") List<Integer> roleIds, @Param("parentId") Integer parentId);
}
